/*
 * @Description:
 * @Author: xunzhaotech
 * @Email: luyb@xunzhaotech.com
 * @QQ: 1525572900
 * @Date: 2025-03-05 13:41:52
 * @LastEditTime: 2025-03-22 22:33:26
 * @LastEditors: xunzhaotech
 */
import request from '@/config/axios'

// ERP 客户标签 VO
export interface CustomerTagVO {
  id: number // 标签编号
  name: string // 标签名称
  remark: string // 备注
  status: number // 开启状态
  sort: number // 排序
  customerIds?: number[] | string // 关联的客户ID列表，可能是数组或字符串
  customIds?: number[] | string // 关联的客户ID列表，可能是数组或字符串
  customerIdsStr?: string // 关联的客户ID字符串，逗号分隔
}

// ERP 客户标签 API
export const CustomerTagApi = {
  // 查询ERP 客户标签分页
  getCustomerTagPage: async (params: any) => {
    return await request.get({ url: `/erp/customer-tag/page`, params })
  },
  // 查询ERP 客户数据分页
  getCustomerDataPage: async (params: any) => {
    return await request.get({ url: `/erp/customer/data-page`, params })
  },

  // 查询ERP 客户标签详情
  getCustomerTag: async (id: number) => {
    return await request.get({ url: `/erp/customer-tag/get?id=` + id })
  },

  // 查询ERP 客户标签精简列表
  getCustomerTagSimpleList: async () => {
    return await request.get({ url: `/erp/customer-tag/simple-list` })
  },

  // 新增ERP 客户标签
  createCustomerTag: async (data: CustomerTagVO) => {
    return await request.post({ url: `/erp/customer-tag/create`, data })
  },

  // 修改ERP 客户标签
  updateCustomerTag: async (data: CustomerTagVO) => {
    return await request.put({ url: `/erp/customer-tag/update`, data })
  },

  // 删除ERP 客户标签
  deleteCustomerTag: async (id: number) => {
    return await request.delete({ url: `/erp/customer-tag/delete?id=` + id })
  },

  // 导出ERP 客户标签 Excel
  exportCustomerTag: async (params) => {
    return await request.download({ url: `/erp/customer-tag/export-excel`, params })
  }
}
